package edu.ccut.saturn.studio.naviagtor.tester;

import org.eclipse.core.expressions.PropertyTester;

/**
 * 通过扩展点，添加一个表达式，来判断文件是否为jar中的.saturn文件。 扩展点为
 * org.eclipse.core.expressions.propertyTesters。
 * 
 * @author alf 2008-9-1
 */
public class JarSaturnTester extends PropertyTester {

	public boolean test(Object receiver, String property, Object[] args,
			Object expectedValue) {
		if ("jar".equalsIgnoreCase(property)
				&& null != receiver
				&& receiver instanceof org.eclipse.jdt.internal.core.JarEntryFile) {

			org.eclipse.jdt.internal.core.JarEntryFile resource = (org.eclipse.jdt.internal.core.JarEntryFile) receiver;

			if (resource.getName().endsWith(".saturn")) {
				return true;
			}
		}
		
		return false;
	}

}
